import Vue from 'vue'
import VueRouter from 'vue-router'

import MyCustomTest from '../views/MyCustomTest.vue'
import MyCustomTest2 from '@/views/MyCustomTest2.vue'
import MyCustomTest3 from '@/views/MyCustomTest3.vue'
import MyCustomTest4 from '@/views/MyCustomTest4.vue'
import MyCustom404 from '@/views/MyCustom404.vue'

Vue.use(VueRouter)

const router = new VueRouter({
    mode: 'history',
    routes: [
        { name: 'myTest', path: '/test', component: MyCustomTest },
        { name: 'myTest2', path: '/test2/:key?/key2', component: MyCustomTest2 },
        { path: '/test/test3', component: MyCustomTest3 },
        { path: '/test/test4', component: MyCustomTest4 },
        { path: '/', redirect: { path: 'test7'} },
        { path: '*', component: MyCustom404 },
    ],
    linkActiveClass: 'link-active',
    linkExactActiveClass: 'link-exact-active'
})

export default router

// import MyCustomTest from '@/views/MyCustomTest'
// import MyCustomTest2 from '@/views/MyCustomTest2'

// import Vue from 'vue'
// import VueRouter from 'vue-router'
// Vue.use(VueRouter) // VueRouter插件初始化

// // 创建了一个路由对象
// const router = new VueRouter({
//     // routes 路由规则们
//     // route  一条路由规则 { path: 路径, component: 组件 }
//     routes: [
//                 { path: '/test', component: MyCustomTest },
//                 { path: '/test2', component: MyCustomTest2 },
//     ]
// })

// export default router